package tech.aistar.mapper.noteinfo;

import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;
import tech.aistar.entity.authordis.NoteAuthor;
import tech.aistar.entity.authordis.Notes;
import tech.aistar.entity.authordis.NotesInfo;
import tech.aistar.entity.authordis.UserTable;

import java.util.List;

/**
 * Created by lenovo on 2019/10/7.
 */
public interface INoteInfoMapper {

    /**
     * 通过id获取游记信息
     * @param id
     * @return
     */
    @Select("select * from notes where id = #{value}")
    Notes findNotesById(Integer id);

    /**
     *通过id获取游记作者信息
     * @param id
     * @return
     */
    @Select("select * from note_author where id = #{value}")
    NoteAuthor findNoteAuthorById(Integer id);


    /**
     * 通过id获取用户信息
     * @param id
     * @return
     */
    @Select("select * from user_table where id = #{value}")
    UserTable findUserById(Integer id);

    /**
     * 部分读取文本
     * @param id
     * @return
     */
    @Select("select * from notes_info where notes_id=#{value} and page_id = 1")
    List<NotesInfo> findPartById(Integer id);

    /**
     * 读取全部文本
     * @param id
     * @return
     */
    @Select("select * from notes_info where notes_id=#{value}")
    List<NotesInfo> findAllById(Integer id);

    @Select("select * from notes_info where notes_id=#{value}")
    NotesInfo findconById(Integer id);

    /**
     * 根据游记的所属地点,查询相关游记
     * @param notePlace
     * @return
     */
    @Select("select * from notes where note_place=#{notePlace}")
    List<Notes> findRelNotes(String notePlace);



}
